<?php
/* [DoYouHaoBaby!] (C)Dianniu From 2010.
   this($)*/

!defined('DYHB_PATH') && exit;

class TemplateGtkGladeWidgetCompiler_GtkContainer extends TemplateGtkGladeWidgetCompilerBase{

	protected function compileCreateWidget_(TemplateGtkGladeWidget $oObject){
		$sWidgetClass=$oObject->getWidgetClass();
		$sVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oObject);
		return
"		{$sVariableName}=new {$sWidgetClass}();
";
	}

	protected function compileChildWidgetPacking_(TemplateGtkGladeWidget $oParentWidget,TemplateGtkGladeWidget $oChildWidget,TemplateGtkGladeWidgetPacking $oPacking){
		$sParentVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oParentWidget);// 父/子 窗体变量名
		$sChildWidgetVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oChildWidget);
		$sChildWidgetId=$oChildWidget->getWidgetId();
		$sCompiled="\t\t{$sChildWidgetVariableName}=\$this->getWidget('{$sChildWidgetId}',\$arrObjectForSignal);";
		$sCompiled.="\t\t{$sParentVariableName}->add({$sChildWidgetVariableName});";
		return $sCompiled;
	}

	static public function regToProcessorManager(ITemplateObjProcessorManager $oManager){
		$oManager->regProcessor(str_replace('TemplateGtkGladeWidgetCompiler_','',__CLASS__),__CLASS__);
	}

}
